package com.ruoyi.training.service.impl;

import java.util.List;

import com.ruoyi.training.domain.CertificateField;
import com.ruoyi.training.mapper.CertificateFieldMapper;
import com.ruoyi.training.service.ICertificateFieldService;
import com.ruoyi.training.util.xuehua.SnowflakeIdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 证书自定义内容配置Service业务层处理
 * 
 * @author hcc
 * @date 2025-11-06
 */
@Service
public class CertificateFieldServiceImpl implements ICertificateFieldService
{
    @Autowired
    private CertificateFieldMapper certificateFieldMapper;

    /**
     * 查询证书自定义内容配置
     * 
     * @param certificateFieldId 证书自定义内容配置主键
     * @return 证书自定义内容配置
     */
    @Override
    public CertificateField selectCertificateFieldByCertificateFieldId(String certificateFieldId)
    {
        return certificateFieldMapper.selectCertificateFieldByCertificateFieldId(certificateFieldId);
    }

    /**
     * 查询证书自定义内容配置列表
     * 
     * @param certificateField 证书自定义内容配置
     * @return 证书自定义内容配置
     */
    @Override
    public List<CertificateField> selectCertificateFieldList(CertificateField certificateField)
    {
        return certificateFieldMapper.selectCertificateFieldList(certificateField);
    }

    /**
     * 新增证书自定义内容配置
     * 
     * @param certificateField 证书自定义内容配置
     * @return 结果
     */
    @Override
    public int insertCertificateField(CertificateField certificateField)
    {
        certificateField.setCertificateFieldId(String.valueOf(new SnowflakeIdUtils(5,8).nextId()));
        return certificateFieldMapper.insertCertificateField(certificateField);
    }

    /**
     * 修改证书自定义内容配置
     * 
     * @param certificateField 证书自定义内容配置
     * @return 结果
     */
    @Override
    public int updateCertificateField(CertificateField certificateField)
    {
        return certificateFieldMapper.updateCertificateField(certificateField);
    }

    /**
     * 批量删除证书自定义内容配置
     * 
     * @param certificateFieldIds 需要删除的证书自定义内容配置主键
     * @return 结果
     */
    @Override
    public int deleteCertificateFieldByCertificateFieldIds(String[] certificateFieldIds)
    {
        return certificateFieldMapper.deleteCertificateFieldByCertificateFieldIds(certificateFieldIds);
    }

    /**
     * 删除证书自定义内容配置信息
     * 
     * @param templateId 证书自定义内容配置主键
     * @return 结果
     */
    @Override
    public int deleteCertificateFieldByTemplateId(String templateId)
    {
        return certificateFieldMapper.deleteCertificateFieldByTemplateId(templateId);
    }
}
